package com.wzdigit.wms.hm.interceptor;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;


@Component
@Slf4j
//public class XmlnsInterceptor extends AbstractPhaseInterceptor {
public class XmlnsInterceptor  {

//    public XmlnsInterceptor(String phase) {
//        super(phase);
//    }

//    private static Logger logger = LoggerFactory.getLogger(XmlnsInterceptor.class);
//
//    public XmlnsInterceptor() {
////        super(Phase.PREPARE_SEND);
//        super(Phase.PRE_STREAM);
//    }
//
//    public XmlnsInterceptor(String phase) {
//        super(phase);
//    }

//    @Override
//    public void handleMessage(Message message) throws Fault {
//        try {
//            //需要放置在根节点的命名空间
////            Map<String, String> envMap = new HashMap<>();
//////            envMap.put("soap-env", "http://schemas.xmlsoap.org/soap/envelope/");
//////            envMap.put("soap-enc", "http://schemas.xmlsoap.org/soap/encoding/");
////            envMap.put("cwmp", "urn:dslforum-org:cwmp-1-0");
////
////	    //在命名空间下的元素都以自定义前缀生成
////            Map<String, String> namespaceMap = new HashMap<>();
////            namespaceMap.put("urn:dslforum-org:cwmp-1-0", "cwmp");
//////            namespaceMap.put("http://schemas.xmlsoap.org/soap/envelope/", "soap-env");
//////            namespaceMap.put("http://schemas.xmlsoap.org/soap/encoding/", "soap-enc");
////            JAXBDataBinding dataBinding = (JAXBDataBinding) message.getExchange().getEndpoint().getService()
////                    .getDataBinding();
////            dataBinding.setNamespaceMap(namespaceMap);
////
////            message.put("soap.env.ns.map", envMap);
////            message.put("disable.outputstream.optimization", true);
//
//
//
//
//
//            //--------------
//            Map<String, String> envMap = new HashMap<String, String>();
//            envMap.put( "soapenv" , "http://schemas.xmlsoap.org/soap/envelope/");
//
//            Map<String, String> nsMap = new HashMap<String, String>();
//            nsMap.put( "http://pal.service.hm.wms.wzdigit.com" , "aaaaaaaaaaaaaaaaaaaaaaa" );
//
//            JAXBDataBinding dataBinding = (JAXBDataBinding)message.getExchange().getEndpoint().getService().getDataBinding();
//            dataBinding.setNamespaceMap(nsMap);
//            message.put("soap.env.ns.map", envMap);
//        } catch (Exception e) {
//            log.error("cxfInterceptor error", e);
//        }
//    }
}